//
//  ViewController.swift
//  表情键盘
//
//  Created by 雄 on 15/7/20.
//  Copyright © 2015年 雄. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    // 直接调用 EmoticonKBViewController 构造函数, 被点击的表情以闭包的形式传过来,直接使用
    lazy var emoticonKBVC: EmoticonKBViewController = EmoticonKBViewController { [unowned self] (emoticon) -> () in
        
        self.textView.insertEmoticon(emoticon)
    }
    
    
    @IBAction func sendText(sender: AnyObject) {
        
        print(textView.emoticonText())
    }
    


    @IBOutlet weak var textView: UITextView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
//        addChildViewController(emoticonKBVC)

        textView.inputView = emoticonKBVC.view
        textView.alwaysBounceVertical = true
        textView.keyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag
    }

  
    deinit {
        print("888")
    }
    
    

}

